<?php
namespace Cms\Controller;
use Admin\Api\PostApi;
use Cms\Model\PostModel;
use Think\Controller;



class HomeController extends Controller {
    public function viewtest(){
        header('content-type:text/html;charset=utf-8');
        $User = M("post");
        $list = $User->where()->select();
        $this->assign('list',$list);
        $this->display('');
//        dump($list);
    }


    public function index(){
        header('content-type:text/html;charset=utf-8');

        $page = array('curpage'=>I('get.p',0),'size'=>3);

        $map = array();

        $result = apiCall(PostApi::QUERY,array($map,$page));

        //$result = $post->query($map,$page);

        if($result['status']){

            $this->assign("show",$result['info']['show']);
            $this->assign("list",$result['info']['list']);
            $this->display('');
//            dump($result);
        }else{
            $this->error($result['info']);
        }
//        $value =  $_SESSION['var']; // 获取SESSION变量

    }

    public function view(){
        $id = I('id',-1,'int');

        $map['id']=$id;

        $result = apiCall(PostApi::GET_INFO,array($map));
        dump($result);

        $this->display();
    }
}